<template>
  <div style="padding: 30px;">
    <div class="box-card">
      <div style="font-weight: 700;font-size: 22px;margin: 20px 0;">
        资格申请-初审
      </div>
      <div class="f-column-between">
        <div class="f-row">
          <div style="width: 40%;"> <span>项目方公司名称：{{details.company}}</span></div>
          <div style="width: 40%;"><span>项目方公司文件资料：{{details.buLiGroupId}} -- {{details.companyRegGroupId}}</span></div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;"> <span>公司注册查询链接：{{details.companyRegUrl}} </span></div>
          <div style="width: 40%;"><span>公司查询截图资料：{{details.companyRegGroupId}} </span></div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;"> <span>项目授权人：{{details.authorize}} </span></div>
          <div style="width: 40%;" class="f-row-between"><span>授权人电话：{{details.phone}} </span> <span>授权委托书：{{details.power}}
            </span>
          </div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;"> <span>尽调文件：{{details.surDataGroupId}} </span></div>
          <div style="width: 40%;" class="f-row-between"><span>法律合规文件：{{details.lawDataGroupId}} </span> <span>审计文件：{{details.audDataGroupId}}
            </span>
          </div>
        </div>
        <div style="margin-top: 20px;width: 90%;" class="f-row-end">
          <div>
            <el-button type="primary" @click="onPass">通过</el-button>
            <el-button type="primary" style="margin-left: 30px;" @click="onNg">不通过</el-button>
          </div>
        </div>
      </div>
    </div>

  </div>
  </div>
</template>

<script>
  import serveApi from "@/api/serveApi"
  export default {
    data() {
      return {
        routeData: {},
        query1: {
          id: 0
        },
        data: {
          approve: '', //string审批0不通过，1通过
          approver: '', //string审批人
          audDataGroupId: '', //string审计资料
          category: '', //string审批类型0初审/1复审
          description: '', //stringdescription
          lawDataGroupId: '', // string法律资料
          stoId: '', // integer($int64)用户sto
          surDataGroupId: '', //string尽调资料
          url: '', // stringurl
        },
        details: {}
      }
    },
    mounted() {
      this.userId = this.$store.state.userInfo.id;
      this.routeData = this.$route.query
      this.getDetails();
    },
    methods: {
      getDetails() {
        this.query1.id = this.routeData.id;
        serveApi.applySto_id(this.query1).then(res => {
          if (res.status == "0000") {
            if (res.data) {
              this.details = res.data;
            }
          } else {
            this.$message.error(res.message);
          }
        });
      },
      onPass() {
        this.data.approve = 1;
        this.data.category = 0;
        this.data.stoId = this.details.id;
        serveApi.applyStoApv_approval(this.data).then(res => {
          if (res.status == "0000") {
           // if (res.data) {
              this.$message.success('保存成功');
              this.$router.push({name:'projects_list'});
              // this.$router.go(-1);
           // }
          } else {
            this.$message.error(res.message);
          }
        });
      },
      onNg() {
        this.data.approve = 0;
        this.data.category = 0;
        this.data.stoId = this.details.id;
        serveApi.applyStoApv_approval(this.data).then(res => {
          if (res.status == "0000") {
           // if (res.data) {
              this.$message.success('保存成功');
              this.$router.push({name:'projects_list'});
              // this.$router.go(-1);
           // }
          } else {
            this.$message.error(res.message);
          }
        });
      }
    }
  }
</script>

<style>
  .box-card {
    padding: 25px;
    box-shadow: 0px 0px 10px 0px rgba(178, 178, 178, 0.2);
    border-radius: 4px;
    background-color: rgba(77, 231, 231, 1.0);
  }
</style>
